import { Module } from '@nestjs/common';
import { AuthService } from './services/auth.service';
import { AuthController } from './auth.controller';
import { JwtModule } from '@nestjs/jwt';
import { jwtConstants } from 'src/common/constants';
import { EmailService } from './services/email.service';
import { MailerModule } from '@nestjs-modules/mailer';
import { UserModule } from 'src/modules/system/user/user.module';

@Module({
  imports: [
    UserModule,
    JwtModule.register({
      global: true,
      secret: jwtConstants.secret,
      signOptions: { expiresIn: '2 days' },
    }),
    MailerModule.forRoot({
      transport: {
        host: 'smtp.ym.163.com',
        port: 25,
        secure: false,
        auth: {
          user: 'system@acxjz.cn',
          pass: 'acxjz@662425',
        },
      },
      defaults: {
        from: '"小橘子管理系统" <system@acxjz.cn>',
      },
    }),
  ],
  controllers: [AuthController],
  providers: [AuthService, EmailService],
})
export class AuthModule {}
